<?php

namespace app\tools;

class Log {

    private static $dir = "/home/log/";

    //写入的操作
    private static function wirteHandle($logDir, $content) {
        $res = fopen($logDir, 'a+');
        fclose($res);
        file_put_contents($logDir, $content."\n", FILE_APPEND);
    }

    //写调试log
    public static function writeLog($content) {
        $logDir = self::$dir.'/'.date('Y-m-d').'.log';
        self::wirteHandle($logDir, $content);
    }

    //写支付以及回调log
    public static function wirtePayLog($content) {
        $logDir = self::$dir.'/pay'.date('Y-m-d').'.log';
        self::wirteHandle($logDir, $content);
    }

    //写返利log
    public static function writeRebateLog($content) {
        $logDir = self::$dir.'/rebate'.date('Y-m-d').'.log';
        self::wirteHandle($logDir, $content);
    }
}